package cc.comac.mom.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.QualityQarCheckInvoiceService;
import cc.comac.mom.bean.QualityQarCheckInvoice;
import cc.comac.mom.bean.QualityQarSplitBean;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/QualityQarCheckInvoice")
public class QualityQarCheckInvoiceController {

	@Autowired
	private QualityQarCheckInvoiceService qualityQarCheckInvoiceService;
	
	@ApiOperation("发布")
	@RequestMapping(value = "/qarIssue",method = RequestMethod.POST)
	public ResultBean qarIssue(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarIssue(obj);
	}

	@ApiOperation("开始检验")
	@RequestMapping(value = "/beginCheck",method = RequestMethod.POST)
	public ResultBean beginCheck(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.beginCheck(obj);
	}

	@ApiOperation("驳回")
	@RequestMapping(value = "/qarReject",method = RequestMethod.POST)
	public ResultBean qarReject(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarReject(obj);
	}

	@ApiOperation("作废")
	@RequestMapping(value = "/qarDisabled",method = RequestMethod.POST)
	public ResultBean qarDisabled(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarDisabled(obj);
	}

	@ApiOperation("提交委托")
	@RequestMapping("/qarEntrust")
	public ResultBean qarEntrust(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarEntrust(obj);
	}

	@ApiOperation("提交审核")
	@RequestMapping(value = "/qarAudit",method = RequestMethod.POST)
	public ResultBean qarAudit(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarAudit(obj);
	}

	@ApiOperation("提交归档")
	@RequestMapping("/qarToFile")
	public ResultBean qarToFile(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.qarToFile(obj);
	}


	@ApiOperation("修改保存")
	@RequestMapping(value = "/update",method = RequestMethod.POST)
	public ResultBean update(@RequestBody QualityQarCheckInvoice obj) {
		// TODO Auto-generated method stub
		return qualityQarCheckInvoiceService.update(obj);
	}
	
	@ApiOperation("拆分")
	@RequestMapping(value = "/qarSplit",method = RequestMethod.POST)
	public ResultBean qarSplit(@RequestBody QualityQarSplitBean obj) {
		return qualityQarCheckInvoiceService.qarSplit(obj);
	}
	
	@ApiOperation("通过QAR编号获取qar对象信息")
	@RequestMapping(value = "/getByQarNo/{qarNo}",method = RequestMethod.GET)
	public ResultBean getByQarNo(@PathVariable String qarNo) {
		return qualityQarCheckInvoiceService.getByQarNo(qarNo);
	}
	@ApiOperation("开立问题单")
	@RequestMapping(value = "/insertQarProblemForm",method = RequestMethod.POST)
	public ResultBean insertQarProblemForm(@RequestBody QualityQarCheckInvoice qualityQarCheckInvoice) {
		ResultBean insertQarProblemForm = qualityQarCheckInvoiceService.insertQarProblemForm(qualityQarCheckInvoice);
		return insertQarProblemForm;
	}
}
